home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Mac Game Programming Gurus / TricksOfTheMacGameProgrammingGurus.iso / Information / CSMP Digest / volume 1 / csmp-v1-137.txt < prev    next >
Encoding:
Text File  |  1994-12-08  |  42.8 KB  |  969 lines  |  [TEXT/R*ch]

  1. C.S.M.P. Digest             Sat, 11 Jul 92       Volume 1 : Issue 137
  2.  
  3. Today's Topics:
  4.  
  5.     Multi-channel synchronized sound
  6.     Pricing of Mac vs Windows development environments
  7.     Space/CheckMark in scroll area
  8.     Is This PostScript ?!
  9.     TCL and Apple Events & aevt rsrc format
  10.     asynchronous XCMDs?
  11.     cmarker for think C 5.0
  12.  
  13.  
  14.  
  15. The Comp.Sys.Mac.Programmer Digest is moderated by Michael A. Kelly.
  16.  
  17. The digest is a collection of article threads from the internet newsgroup
  18. comp.sys.mac.programmer.  It is designed for people who read c.s.m.p. semi-
  19. regularly and want an archive of the discussions.  If you don't know what a
  20. newsgroup is, you probably don't have access to it.  Ask your systems
  21. administrator(s) for details.  (This means you can't post questions to the
  22. digest.)
  23.  
  24. Each issue of the digest contains one or more sets of articles (called
  25. threads), with each set corresponding to a 'discussion' of a particular
  26. subject.  The articles are not edited; all articles included in this digest
  27. are in their original posted form (as received by our news server at
  28. cs.uoregon.edu).  Article threads are not added to the digest until the last
  29. article added to the thread is at least one month old (this is to ensure that
  30. the thread is dead before adding it to the digest).  Article threads that
  31. consist of only one message are generally not included in the digest.
  32.  
  33. The entire digest is available for anonymous ftp from ftp.cs.uoregon.edu
  34. [128.223.8.8] in the directory /pub/mac/csmp-digest.  The most recent issues
  35. are available from sumex-aim.stanford.edu [36.44.0.6] in the directory
  36. /info-mac/digest/csmp.  If you don't have ftp capability, the sumex archive
  37. has a mail server; send a message with the text '$MACarch help' (no quotes)
  38. to LISTSERV@ricevm1.rice.edu for more information.
  39.  
  40. These digest is also available via email.  Just send a note saying that you
  41. want to be on the digest mailing list to mkelly@cs.uoregon.edu, and you will
  42. automatically receive each new issue as it is created.  Sorry, back issues
  43. are not available through the mailing list.
  44.  
  45. Send administrative mail to mkelly@cs.uoregon.edu.
  46.  
  47.  
  48. -------------------------------------------------------
  49.  
  50. From: ldo@waikato.ac.nz (Lawrence D'Oliveiro, Waikato University)
  51. Subject: Multi-channel synchronized sound
  52. Date: 9 Jun 92 13:45:24 +1200
  53. Organization: University of Waikato, Hamilton, New Zealand
  54.  
  55. I've been doing a bit of investigation into the problem of playing multiple
  56. simultaneous channels of sound, while keeping the notes synchronized. It
  57. turns out it's not that hard--provided you keep in mind the limitations
  58. of the particular machine you're running on.
  59.  
  60. The basic technique is to start off all the channels simultaneously, and
  61. make sure the sound channel queues never become empty thereafter. So long
  62. as you ensure this, and calculate all your note and rest durations correctly,
  63. you can run for quite a long time without any drift effects.
  64.  
  65. To start off the channels simultaneously, Jim Reekes' SoundApp example sends
  66. a syncCmd to each channel with SndDoImmediate. The technique I came up with
  67. involves sending a pauseCmd to each channel with SndDoImmediate, then queueing
  68. up some commands in each channel with SndDoCommand, then starting them all off
  69. by sending resumeCmd commands with SndDoImmediate. Either one seems to work
  70. fine.
  71.  
  72. The other problem I thought about was that of accumulated drift after the
  73. channels have been playing for some time. The good news is that the effect
  74. is mostly insignificant, but the bad news is that when it shows up, it shows
  75. up in a big way. That is, you don't get a slow accumulation of drift errors;
  76. instead, things fall apart fairly suddenly.
  77.  
  78. I did some tests with the wave table synthesizer. I came up with a simple
  79. "stress test", which involved repeatedly sounding a chord (a note on each
  80. channel simultaneously) for half a second, alternating with silence on all
  81. channels for half a second. I ran this test with 3 and with 4 channels, on
  82. an LC, an SE and a IIfx. All machines were running System 7 (I know the wave
  83. table synthesizer doesn't work on an LC running 6.0.7).
  84.  
  85. On the LC, 3 simultaneous wave table channels would stay in sync perfectly
  86. for quite a long while. I ran the test once for about half an hour before
  87. a perceptible delay suddenly appeared in one channel. The second time I
  88. tried the same test, it went for over an hour and a quarter without developing
  89. any perceptible drift, before I stopped it to keep from going batty...
  90.  
  91. Four channels didn't work so well. The LC would run for about 15 to 20
  92. seconds before the synchronization fell apart completely--the crisp chord
  93. would turn into a leisurely arpeggio, with the notes sounding in sequence
  94. rather than together.
  95.  
  96. The SE was worse. Both the 3-channel and the 4-channel test fell part
  97. within a few seconds. I haven't tried the IIfx for more than a couple of
  98. minutes at a time, but that one works fine with both tests. I suspect the
  99. same would be true of other models with a genuine Apple Sound Chip, rather
  100. than the imitation in the LC and the Classic II.
  101.  
  102. The interesting thing was, I got better results playing an actual 3- or
  103. 4-part tune, where various channels would pause or rest frequently, than I
  104. did with my stress test. The SE had no problem playing a 3-part tune, though
  105. the 4-part one wasn't very successful. And the LC would play even the 4-part
  106. tune without any problems, even though it goes for rather longer than the
  107. 4-channel stress test.
  108.  
  109. I then considered the problem of pulling drifting channels into sync. One
  110. of the first things I discovered is that the syncCmd command is useless for
  111. this purpose. In order to use it, you have to feed it to each channel with
  112. a different value for the count, and make sure that the one with the highest
  113. count is processed first, then the one with the next-highest count, and so on.
  114. This is no good if you don't know which way your channels are going to drift!
  115.  
  116. The solution I came up with involved installing a special callback routine
  117. into each channel. I would create a structure containing a list of the
  118. channels to be synchronized, together with a count of those for which the
  119. callback routine hasn't been called yet; then I would queue a callbackCmd
  120. command into each of those channels, at the point in the respective command
  121. streams that I want to be synchronized.
  122.  
  123. Each time the callback routine is entered, it decrements the count in
  124. the common structure. If the count isn't zero, then it suspends its channel
  125. (by sending a pauseCmd with SndDoImmediate). If the count is zero, then
  126. it goes through the list of channels and sends each one a resumeCmd with
  127. SndDoImmediate. Thus all the callback calls except the last one suspend
  128. their respective channels, while the last one restarts them all.
  129.  
  130. I'm pretty sure this code works, because I can introduce intentional audible
  131. discrepancies (both big and small) into the note timings on various channels,
  132. and they disappear on reaching the synchronization point. Yet when I try to
  133. use it to overcome the major synchronization problems I described above, it
  134. makes no difference at all--on the LC, things fall apart just as quickly,
  135. and just as badly.
  136.  
  137. This, together with the fact that the onset of loss of synchronization is
  138. quite sudden, rather than building up gradually, leads me to conclude that
  139. these synchronization problems are due to bugs in the Sound Manager.
  140.  
  141. If anybody wants, I can e-mail them a HyperCard stack (about 54K) in size
  142. that they can use to investigate for themselves. It contains a set of HyperCard
  143. externals I wrote for allocating multiple sound channels and feeding commands
  144. to them. It also implements the callback synchronization technique in an
  145. easy-to-use form.
  146.  
  147. Lawrence D'Oliveiro                       fone: +64-7-856-2889
  148. Computer Services Dept                     fax: +64-7-838-4066
  149. University of Waikato            electric mail: ldo@waikato.ac.nz
  150. Hamilton, New Zealand    37^ 47' 26" S, 175^ 19' 7" E, GMT+12:00
  151.  
  152. ---------------------------
  153.  
  154. From: nagle@netcom.com (John Nagle)
  155. Subject: Pricing of Mac vs Windows development environments
  156. Date: 5 Jun 92 05:35:59 GMT
  157. Organization: Netcom - Online Communication Services  (408 241-9760 guest)
  158.  
  159.  
  160.       Apple, as we all know, just raised the price on ETO to $1250 or so.
  161. Now, Microsoft has also made a price move.  In the other direction.
  162. I just received an ad for Microsoft's C/C++ environment.  This 
  163. includes C,C++, windows SDK, Dialog Editor, Image Editor, Font Editor,
  164. 75,000 lines of sample code, stress testing package, Help Compiler,
  165. CodeView debugger, and a source profiler, plus online documentation.
  166. Some manuals, too.  (About 9" or so worth, it looks like.  A full manual 
  167. set of 4,000 pages is available separately for $150).
  168.  
  169.      The price is $139 until June 30.  That's right, only $139, about 
  170. 1/10th of what Apple charges.  
  171.  
  172.      Does Apple yet perceive that they might have a problem?  
  173.  
  174.                     John Nagle
  175.  
  176. ps: (Microsoft is at 1-800-992-3675, ext. "NQ5").
  177.  
  178. +++++++++++++++++++++++++++
  179.  
  180. From: potts@itl.itd.umich.edu (Paul Potts)
  181. Organization: Instructional Technology Laboratory, University of Michigan
  182. Date: Fri, 5 Jun 92 13:59:09 GMT
  183.  
  184. In article <#l#l0--.nagle@netcom.com> nagle@netcom.com (John Nagle) writes:
  185. >
  186. >      Apple, as we all know, just raised the price on ETO to $1250 or so.
  187. >Now, Microsoft has also made a price move.  In the other direction.
  188. >I just received an ad for Microsoft's C/C++ environment.  This 
  189. >includes C,C++, windows SDK, Dialog Editor, Image Editor, Font Editor,
  190. >75,000 lines of sample code, stress testing package, Help Compiler,
  191. >CodeView debugger, and a source profiler, plus online documentation.
  192. >Some manuals, too.  (About 9" or so worth, it looks like.  A full manual 
  193. >set of 4,000 pages is available separately for $150).
  194. >
  195. >     The price is $139 until June 30.  That's right, only $139, about 
  196. >1/10th of what Apple charges.  
  197. >
  198.  
  199. No, it's not. The $139 price is the "competitive upgrade." You have to return
  200. to Microsoft a master disk or a page from your manual for a competing product.
  201. I purchased the Borland C++ 3.0 package (list price about $495) for $359, and
  202. got the competitive upgrade for $139. The additional manuals (really a
  203. necessity if you are going to do Windows programming cost $150). So, the
  204. complete package runs around $648 to get both packages. If you want to buy
  205. the Microsoft development system alone it is $349 from the Programmer's shop.
  206.  
  207. Yes, these packages are both good deals. However, having used both, I don't
  208. believe they are the equivalent of ETO. The price war for Windows/DOS
  209. development tools is becoming quite intense, and the tools are becoming 
  210. better - both C++ compilers are excellent, although I am leaning towards
  211. the Borland C++ IDE. Maybe when there are as many Apple machines (or Power
  212. PCs) as DOS machines out there, there will be as much competition and
  213. price-cutting in developent environments.
  214.  
  215. By the way, these *are* PC packages: The Borland C++ IDE freezes when I try
  216. to use my Acer mouse; the Microsoft package bombs when run under DOS using
  217. HIMEM.SYS and EMM386, but requires 386MAX, which crashes the Borland C++ IDE;
  218. there is a bomb when I try to run the Borland C++ IDE under Windows 3.1 using
  219. my Logitech trackball; my Stealth VRAM video card does an incredible monitor-
  220. blowing flicker and jig when swapping between video modes under the Microsoft
  221. PWB... I *was* able to come up with configurations that are stable for each
  222. product, but keep in mind these are not Macintosh programs, nor is Windows
  223. and DOS the Mac OS. Just thought I'd mention that, because I often hear things
  224. like "how come I can get a 16 MHz 486 machine with a 19" color monitor and
  225. a 400 meg hard drive for $900 when a Mac Plus costs four thousand dollars?"
  226. Don't get me wrong - I think these tools are a good deal, or I wouldn't have
  227. bought both of them, but given my preference I would be running a fast
  228. C++ compiler on a Mac instead. (If there was one...).
  229.  
  230. - -- 
  231. The essence of OOP: "With all this horse manure, I know there's got to be
  232.                      a pony in here somewhere!"
  233. Paul R. Potts, Software Designer --- potts@itl.itd.umich.edu <--- me!
  234.  
  235. +++++++++++++++++++++++++++
  236.  
  237. From: nagle@netcom.com (John Nagle)
  238. Date: Sun, 07 Jun 92 03:57:58 GMT
  239. Organization: Netcom - Online Communication Services  (408 241-9760 guest) 
  240.  
  241. potts@itl.itd.umich.edu (Paul Potts) writes:
  242.  
  243. >No, it's not. The $139 price is the "competitive upgrade." You have to return
  244. >to Microsoft a master disk or a page from your manual for a competing product.
  245.  
  246.       No, Microsoft has dropped that requirement, according to the
  247. brochure they sent me.  This is a sale, through June 30, for $139,
  248. plus sales tax, plus $20 "freight" (it's a big box).
  249.  
  250.       I don't know whether it's any good, but it's big and cheap.
  251.  
  252.                     John Nagle
  253.  
  254. +++++++++++++++++++++++++++
  255.  
  256. From: potts@itl.itd.umich.edu (Paul Potts)
  257. Organization: Instructional Technology Laboratory, University of Michigan
  258. Date: Mon, 8 Jun 92 13:44:11 GMT
  259.  
  260. In article <dh+lyd#.nagle@netcom.com> nagle@netcom.com (John Nagle) writes:
  261. >potts@itl.itd.umich.edu (Paul Potts) writes:
  262. >
  263. >>No, it's not. The $139 price is the "competitive upgrade." You have to return
  264. >>to Microsoft a master disk or a page from your manual for a competing product.
  265. >
  266. >      No, Microsoft has dropped that requirement, according to the
  267. >brochure they sent me.  This is a sale, through June 30, for $139,
  268. >plus sales tax, plus $20 "freight" (it's a big box).
  269.  
  270. Wow!  OK, that's cheap. You will definitely want the $150 set of additional
  271. documentation, if you are planning on doing any Windows programming.
  272.  
  273. Anyone else who has looked at the package care to do a comparison/contrast?
  274. - -- 
  275. The essence of OOP: "With all this horse manure, I know there's got to be
  276.                      a pony in here somewhere!"
  277. Paul R. Potts, Software Designer --- potts@itl.itd.umich.edu <--- me!
  278.  
  279. +++++++++++++++++++++++++++
  280.  
  281. From: Adrian C Ruigrok
  282. Organization: Bell-Northern Research
  283. Date: Mon, 8 Jun 1992 13:54:43 GMT
  284.  
  285. In article <dh+lyd#.nagle@netcom.com> nagle@netcom.com (John Nagle) writes:
  286. >potts@itl.itd.umich.edu (Paul Potts) writes:
  287. >
  288. >>No, it's not. The $139 price is the "competitive upgrade." You have to return
  289. >>to Microsoft a master disk or a page from your manual for a competing
  290. product.
  291. >
  292. >      No, Microsoft has dropped that requirement, according to the
  293. >brochure they sent me.  This is a sale, through June 30, for $139,
  294. >plus sales tax, plus $20 "freight" (it's a big box).
  295. I remain sceptical of the price...  Microsoft's only purpose in life is to make
  296. money.
  297.  
  298. >      I don't know whether it's any good, but it's big and cheap.
  299. >
  300.  
  301. But look what you get from Apple.
  302. I don't know that I could argue that you are getting 10x as much, especially
  303. since I don't have any idea what is in the Microsoft product, but with ETO you
  304. do get a complete, very mature, application framework, 4 ~quarterly updates
  305. (plus or minus a few months) any many other tools.  Would not Microsoft soak
  306. you again in a few months for another $139 for yet another update?  They do it
  307. for everything else!
  308.  
  309. Besides, $139 only buys you a lot of headaches ;-)
  310. Adrian
  311.  
  312. ---------------------------
  313.  
  314. From: mds@bnr.ca (Anthony VanAlphen)
  315. Subject: Space/CheckMark in scroll area
  316. Date: 5 Jun 92 13:49:56 GMT
  317. Organization: bnr
  318.  
  319. While trying to get a check mark into a scroll area we've discovered that the size
  320. of a check is not the same size as a space! We've already tried a non-breaking space.
  321. One alternative is a fixed width font, but the check is available only in the system
  322. font Chicago. 
  323.  
  324. Is there a trick? We *KNOW* this is possible. BTW we are using MPW C and Prototyper.
  325. - -- 
  326. Marty Sells  Phone: (613)-829-5606 (home)  My opinions are my own,
  327. mds@bnr.ca          (613)-763-4485 (work)  not those of by employer..
  328.  
  329. +++++++++++++++++++++++++++
  330.  
  331. From: jpurlia@qualcomm.com (John Purlia)
  332. Date: 8 Jun 92 21:07:56 GMT
  333. Organization: Qualcomm Incorporated
  334.  
  335. In article <1992Jun5.134956.13474@bcrka451.bnr.ca>, mds@bnr.ca (Anthony VanAlphen) writes:
  336. > While trying to get a check mark into a scroll area we've discovered that the size
  337. > of a check is not the same size as a space! We've already tried a non-breaking space.
  338. > One alternative is a fixed width font, but the check is available only in the system
  339. > font Chicago. 
  340. > Is there a trick? We *KNOW* this is possible. BTW we are using MPW C and Prototyper.
  341.  
  342. Just write an LDEF that draws the check, then moves the pen to the horizontal
  343. position at which you wish to draw the text.  Really, an LDEF is one of the
  344. simpler defprocs to create, requvery little overhead, and allows you to truly
  345. customize the appearance of your cell data.
  346.  
  347. - -- John Purlia
  348. ..........................................................................
  349. John Purlia          : My brain; not my company's brain.  My brain says...
  350. jpurlia@qualcomm.com :      "Just about any movie could be made better
  351. AppleLink:  AM0470   :       if one of the characters were a vampire."
  352. ..........................................................................
  353.  
  354. ---------------------------
  355.  
  356. From: ewylie@ocf.berkeley.edu (Elizabeth Wylie)
  357. Subject: Is This PostScript ?!
  358. Date: 7 Jun 92 06:18:52 GMT
  359. Organization: U. C. Berkeley Open Computing Facility
  360.  
  361. Newsgroups: comp.mac.sys.programmer
  362. Subject: Is this PostScript ?!
  363. Summary: 
  364. Followup-To: 
  365. Distribution: world
  366. Organization: U. C. Berkeley Open Computing Facility
  367. Keywords: 
  368.  
  369. I am trying to determine whether a particular font (given a font name and
  370. number) has a PostScript counterpart that will be handled by ATM. I've
  371. been told that ATM has some callback routines that would help me out,
  372. but I don't know what these routines are.
  373.  
  374. Does anyone know of these routines or have another way of determining
  375. whether a PS font will be drawn using PS on the screen?
  376.  
  377. Any pointers would be much appreciated.
  378.  
  379. - -Elizabeth Wylie
  380. ewylie@ocf.berkeley.edu
  381. ~?
  382.  
  383. Newsgroups: comp.sys.mac.programmer
  384. Subject: Is this PostScript?!
  385. Summary: 
  386. Followup-To: 
  387. Distribution: world
  388. Organization: U. C. Berkeley Open Computing Facility
  389. Keywords: 
  390.  
  391. +++++++++++++++++++++++++++
  392.  
  393. From: lim@iris.ucdavis.edu (Lloyd Lim)
  394. Date: 8 Jun 92 16:20:56 GMT
  395. Organization: U.C. Davis - Department of Computer Science
  396.  
  397. In article <10s9ocINNdd2@agate.berkeley.edu> ewylie@ocf.berkeley.edu (Elizabeth Wylie) writes:
  398. >
  399. >I am trying to determine whether a particular font (given a font name and
  400. >number) has a PostScript counterpart that will be handled by ATM. I've
  401. >been told that ATM has some callback routines that would help me out,
  402. >but I don't know what these routines are.
  403. >
  404. >Does anyone know of these routines or have another way of determining
  405. >whether a PS font will be drawn using PS on the screen?
  406.  
  407. Yes, the procedure is named fontAvailableATM.  It's not hard but it's
  408. a bit long to describe here.  You can call Adobe Developer Support
  409. (415-961-4111) an ask for the second ATM tech note ("Advanced Type
  410. Capabilities Using Adobe Type Manager on the Macintosh") and they'll
  411. send it to you for free.  The note includes sample code.  I think you
  412. might even be able to get a disk with C files on it.
  413.  
  414. +++
  415. Lloyd Lim               Internet: lim@cs.ucdavis.edu
  416. 224 Lysle Leach Hall    America Online: LimUnltd
  417. U.C. Davis              AppleLink: LimUnltd
  418. Davis, CA  95616        CompuServe: 72647,660
  419.  
  420. ---------------------------
  421.  
  422. From: montford@ukfca1 (Piran Montford)
  423. Subject: TCL and Apple Events & aevt rsrc format
  424. Date: 8 Jun 92 07:57:52 GMT
  425. Organization: Schlumberger Technologies, Board Test, Ferndown, England
  426.  
  427. I'm sorry, this is a rather ill researched question, but I'm loosing my
  428. news access soon, and I'd like this question discussed before I start my
  429. final year project for my degree course:
  430.  
  431. What I want to know about is writing an apple-event driven program with
  432. the TCL class library. The question is, once I get a command, should I turn
  433. that into an apple-event, receive that, and then turn that into a CTask, or
  434. should I generate the CTask, which then sends apple-events that I then execute?
  435. How does this effect undoing, and the recording of apple-events?
  436.  
  437. command -> apple-event -> CTask     OR    command -> CTask -> apple-event
  438.  
  439. Any pointers, handles, or even help, would be greatefully received.
  440.  
  441. Also, could someone mail me with the aevt resource description, or even
  442. where I could get it. Don't say develop coz I aint got it, and no 640MB of
  443. space to unpack the stuff from apple.com.
  444.  
  445.             BCNU, Piran.
  446.  
  447. P.D.N.A.A.R.O.D.D.Montford, montford@uk.ate.slb.com, (JUST A STUDENT HERE)
  448. Soon to be pdnm@vms.bton.ac.uk. Goons, Prisoner, Pooh Bear, I just love 'em.
  449. You wanna disclaimer? Use your own. I'm being paid to do other things...
  450.  
  451. +++++++++++++++++++++++++++
  452.  
  453. From: molla@paone.uucp (Levent Mollamustafaoglu)
  454. Date: 8 Jun 92 16:32:26 GMT
  455. Organization: Aiken Computation Lab, Harvard University
  456.  
  457. In article <512@catnip.UUCP> montford@ukfca1 (Piran Montford) writes:
  458. >I'm sorry, this is a rather ill researched question, but I'm loosing my
  459. >news access soon, and I'd like this question discussed before I start my
  460. >final year project for my degree course:
  461. >
  462. >What I want to know about is writing an apple-event driven program with
  463. >the TCL class library. The question is, once I get a command, should I turn
  464. >that into an apple-event, receive that, and then turn that into a CTask, or
  465. >should I generate the CTask, which then sends apple-events that I then execute?
  466. >How does this effect undoing, and the recording of apple-events?
  467. >
  468. >command -> apple-event -> CTask     OR    command -> CTask -> apple-event
  469. >
  470. >Any pointers, handles, or even help, would be greatefully received.
  471. >
  472.  
  473. As far as I've seen from looking at the Apple event support in TCL,
  474. the CSwitchboard object catches incoming Apple events and wraps them
  475. up in a CAppleEvent object for you. The CApplication object handles
  476. the four required Apple events for you (Open Doc etc.). If you want
  477. to handle other Apple events, then your subclass for CApplication
  478. should override the DOAppleEvent method to add statements for those.
  479. Note that these other Apple events will be wrapped in CAppleEvent
  480. objects for you. The only thing you should do is write the methods
  481. to handle them.
  482.  
  483. As to sending Apple events, it is more complicated. TCL does not have
  484. support (at least in a clever OOP way) for sending Apple events. 
  485. Just to give an example, you can not set the target application 
  486. anywhere in CAppleEvent, since it handles only incmoing events
  487. (which automatically have the reply information). What you can do is
  488. write a new type of Apple event class that handles outgoing events,
  489. and maybe you can handle undo and other details that way.
  490.  
  491. This might be obscure, but there is as yet very little sample code
  492. or reusable classes for wide Apple event support. (Maybe that's why
  493. most applications only support the required Apple events and
  494. possibly publish-subscribe :-) )
  495.  
  496.  
  497. ===========================================================================
  498. Dr. Levent Mollamustafaoglu       Harvard University    
  499. molla@paone.harvard.edu    molla@metatron.harvard.edu
  500. ===========================================================================
  501.  
  502. ---------------------------
  503.  
  504. From: taihou@chromium.iss.nus.sg (Tng Tai Hou)
  505. Subject: asynchronous XCMDs?
  506. Organization: Institute of Systems Science, NUS, Singapore
  507. Date: Thu, 4 Jun 1992 09:04:57 GMT
  508.  
  509. I need to write an XCMD for SuperCard/HyperCard that is
  510. asynchronous. In SoundEdit Pro's Fplay, which is a substitute
  511. play command for Hypercard, it can play sound files of its own
  512. formats and return without the sound stopping: the sound
  513. channel is still active, as is the code resource, since
  514. a stop command can be sent to Fplay to stop that sound.
  515.  
  516. Can someone kindly explain how this is done? How can I reference
  517. any memory space allocated by an XCMD again? In this case, a sound
  518. channel, which is handle to a sound resource.
  519.  
  520. Thanks.
  521.  
  522. Tai Hou
  523. Singapore
  524.  
  525. +++++++++++++++++++++++++++
  526.  
  527. From: ldo@waikato.ac.nz (Lawrence D'Oliveiro, Waikato University)
  528. Date: 9 Jun 92 10:31:47 +1200
  529. Organization: University of Waikato, Hamilton, New Zealand
  530.  
  531. In article <1992Jun4.090457.18584@nuscc.nus.sg>, taihou@chromium.iss.nus.sg (Tng Tai Hou) writes:
  532. > I need to write an XCMD for SuperCard/HyperCard that is
  533. > asynchronous. In SoundEdit Pro's Fplay, which is a substitute
  534. > play command for Hypercard, it can play sound files of its own
  535. > formats and return without the sound stopping: the sound
  536. > channel is still active, as is the code resource, since
  537. > a stop command can be sent to Fplay to stop that sound.
  538.  
  539. There are several different ways to keep things in memory in-between
  540. calls to a HyperCard external. One way is to use a global variable (and
  541. hope that its name doesn't clash with anything else). Or you could load
  542. something into the system heap and install a Gestalt selector to refer to it
  543. (unfortunately Gestalt selectors can't point to things in the application
  544. heap). You could poke an address into your XCMD or XFCN resource, but I
  545. personally wouldn't trust that as a very reliable technique.
  546.  
  547. HyperCard 2.x offers another technique: create an external window ("xwindow")
  548. and stick a pointer to your storage in its refcon field. If you make this an
  549. invisible window, the user never has to be aware that it is there. It is even
  550. possible to find the xwindow again on a subsequent call without having to store
  551. a pointer to it in some other global location (e-mail me for details about
  552. this technique). And with HyperCard 2.1, you can refer to the window by ID,
  553. so you don't have to worry about giving it a unique name.
  554.  
  555. Lawrence D'Oliveiro                       fone: +64-7-856-2889
  556. Computer Services Dept                     fax: +64-7-838-4066
  557. University of Waikato            electric mail: ldo@waikato.ac.nz
  558. Hamilton, New Zealand    37^ 47' 26" S, 175^ 19' 7" E, GMT+12:00
  559.  
  560. +++++++++++++++++++++++++++
  561.  
  562. From: potts@itl.itd.umich.edu (Paul Potts)
  563. Date: 9 Jun 92 12:59:13 GMT
  564. Organization: Instructional Technology Laboratory, University of Michigan
  565.  
  566. In article <1992Jun9.103147.8511@waikato.ac.nz> ldo@waikato.ac.nz (Lawrence D'Oliveiro, Waikato University) writes:
  567. >In article <1992Jun4.090457.18584@nuscc.nus.sg>, taihou@chromium.iss.nus.sg (Tng Tai Hou) writes:
  568. >> I need to write an XCMD for SuperCard/HyperCard that is
  569. >> asynchronous. In SoundEdit Pro's Fplay, which is a substitute
  570. >> play command for Hypercard, it can play sound files of its own
  571. >> formats and return without the sound stopping: the sound
  572. >> channel is still active, as is the code resource, since
  573. >> a stop command can be sent to Fplay to stop that sound.
  574. >
  575. >There are several different ways to keep things in memory in-between
  576. >calls to a HyperCard external. One way is to use a global variable (and
  577. >hope that its name doesn't clash with anything else). Or you could load
  578. >something into the system heap and install a Gestalt selector to refer to it
  579. >(unfortunately Gestalt selectors can't point to things in the application
  580. >heap). You could poke an address into your XCMD or XFCN resource, but I
  581. >personally wouldn't trust that as a very reliable technique.
  582. >
  583. >HyperCard 2.x offers another technique: create an external window ("xwindow")
  584. >and stick a pointer to your storage in its refcon field. 
  585. ...
  586.  
  587. It is also possible to have your XCMD/XFCN lock itself on the heap and keep
  588. a record of its state. This is somewhat more memory-intensive for a large
  589. XCMD/XFCN but it is the technique that I use. I've never had any problems
  590. with this technique except for a compatibility problem with an old RadiusWare
  591. INIT which put a non-relocatable block right on top of Hypercard's window
  592. data, making it non-resizable. The only caveat is that if you open a second
  593. stack, the XCMD will be purged even though it is locked. This would probably
  594. cause a crash if an asynch sound was playing, since the callback routine
  595. would be wiped out. However, if your stack can prevent the user from opening
  596. another stack it should be safe.
  597.  
  598. My XFCN is pretty robust and does thorough error-checking; I've been using
  599. it for over a year now and don't see any hangs or crashes. I haven't
  600. worked on it for awhile, though. I know I was experimenting with asynch sound
  601. but I can't remember if I got it working in the XFCN. If you are interested
  602. in "borrowing" the XFCN let me know via mail.
  603.  
  604. I know that the self-locking XFCN is probably a bad idea as far as being
  605. friendly to other applications and to Hypercard, but it works... right now,
  606. none of my sets of calls to the XFCN exceed the bounds of a single script
  607. handler; that is, the XFCN never is locked for longer than it takes to
  608. finish executing a single mouseUp handler. Supporting asynch sound changes
  609. this some, so it will have to be tested thoroughly under these conditions.
  610.  
  611. - -- 
  612. The essence of OOP: "With all this horse manure, I know there's got to be
  613.                      a pony in here somewhere!"
  614. Paul R. Potts, Software Designer --- potts@itl.itd.umich.edu <--- me!
  615.  
  616. ---------------------------
  617.  
  618. From: francois@welchgate.welch.jhu.edu (Francois Schiettecatte)
  619. Subject: cmarker for think C 5.0
  620. Organization: Johns Hopkins Univ. Welch Medical Library
  621. Date: Sat, 6 Jun 1992 18:06:26 GMT
  622.  
  623. I have seen a very useful utility for think C 4.0.x called
  624. CMarker, it puts an extra icon up on the menu bar of an 
  625. editing window and allows you to scroll down to functions
  626. very quickly. I have not gotten it to work for think C 5.0.x.
  627. Does anyone know how I could get it to work with 5.0.x or
  628. is there a newer version which does.
  629.  
  630. thanks
  631.  
  632.  
  633.  
  634. francois
  635.  
  636.  
  637. Francois Schiettecatte
  638. Software Engineer
  639. Welch Medical Library
  640. Johns Hopkins University
  641. Internet: francois@library.welch.jhu.edu
  642. Phone    : (410) 955-7581
  643.  
  644.  
  645. +++++++++++++++++++++++++++
  646.  
  647. From: mspace@netcom.com (Brian Hall)
  648. Date: Sat, 06 Jun 92 20:22:20 GMT
  649. Organization: Netcom - Online Communication Services  (408 241-9760 guest) 
  650.  
  651. francois@welchgate.welch.jhu.edu (Francois Schiettecatte) writes:
  652.  
  653. >I have seen a very useful utility for think C 4.0.x called
  654. >CMarker, it puts an extra icon up on the menu bar of an 
  655. >editing window and allows you to scroll down to functions
  656. >very quickly. I have not gotten it to work for think C 5.0.x.
  657. >Does anyone know how I could get it to work with 5.0.x or
  658. >is there a newer version which does.
  659.  
  660. I got it to "work" (see below) in Think C 5.x by installing it into 5.0
  661. and then performing the 5.0->5.x updates.  It would not install directly
  662. into 5.0.2.  It mostly works, but seems to have trouble with the new
  663. C++ style comments "//".  If you avoid them, you are fine.
  664.  
  665. Another alternative I suggest you look into is PopupFuncs.  It works with
  666. Think C 5.0 just fine, and does MPW Pascal, C, C++, and Rez as well. I
  667. believe there is a special for users of the ShareWare BBEdit for $30,
  668. contact the author of PUF at one of:
  669.  
  670. AOL: ESLOSSER, SLOSSER
  671. AppleLink: D3979
  672. slosser@mindseye.berkeley.edu
  673.  
  674. >From a user of both CMarker and PUF:
  675.  
  676. - -- 
  677.  
  678.  \ | /   | Brian Hall                 mspace@netcom.com
  679.  - : -   | Mark/Space Softworks       Applelink: markspace
  680.   /|\    |                            America Online: MarkSpace
  681.  |-+-|   |
  682. /-\|/-\  | People don't kill people, toasters kill people.
  683.  
  684. +++++++++++++++++++++++++++
  685.  
  686. From: siegel@world.std.com (Rich Siegel)
  687. Date: 6 Jun 92 21:17:53 GMT
  688. Organization: GCC Technologies
  689.  
  690. In article <f!+ldwr.mspace@netcom.com> mspace@netcom.com (Brian Hall) writes:
  691. >
  692. >Another alternative I suggest you look into is PopupFuncs.  It works with
  693. >Think C 5.0 just fine, and does MPW Pascal, C, C++, and Rez as well. I
  694. >believe there is a special for users of the ShareWare BBEdit for $30,
  695.  
  696.     BBEdit isn't shareware, it's free.
  697.  
  698.     PopupFuncs and BBEdit work very well together, by design; Eric
  699. and I collaborated on the low-level interface, so PopupFuncs doesn't require
  700. any nasty hacking to work seamlessly with BBEdit.
  701.  
  702. R.
  703.  
  704.  
  705.  
  706. - -- 
  707. - -----------------------------------------------------------------------
  708. Rich Siegel                              Internet: siegel@world.std.com
  709. Software Engineer & Toolsmith
  710. GCC Technologies
  711.  
  712. +++++++++++++++++++++++++++
  713.  
  714. From: michel@cst02.segin.com (Michel Pollet)
  715. Organization: Groupe Axime
  716. Date:  7 Jun 92 13:12:29 GMT
  717.  
  718. francois@welchgate.welch.jhu.edu (Francois Schiettecatte) writes:
  719. >I have seen a very useful utility for think C 4.0.x called
  720. >CMarker, it puts an extra icon up on the menu bar of an 
  721. >editing window and allows you to scroll down to functions
  722. >very quickly. I have not gotten it to work for think C 5.0.x.
  723. >Does anyone know how I could get it to work with 5.0.x or
  724. >is there a newer version which does.
  725.  
  726.     There a way around this : Just put the 'right' value in the 
  727.     proc id of the document window of Think C with resedit. There
  728.     a little bug in the cmarker's installer. With this trick, I uses
  729.     cmarker on C only (no c++) sources and it seems to work fine.
  730.     I Think that PopupFuncs is the 'new' version of this utility. Right?
  731.  
  732. Michel
  733.  
  734.  
  735. - -- 
  736. - -                                 Michel Pollet                               -
  737. - --       michel@cst02.segin.com (Office), michel@trantor.gna.org (Home)      --
  738. - -               Nothing is ever accomplished by a reasonable man.            --
  739.  
  740. +++++++++++++++++++++++++++
  741.  
  742. From: phils@chaos.cs.brandeis.edu (Phil Shapiro)
  743. Date: 8 Jun 92 00:35:48 GMT
  744. Organization: Symantec Corp.
  745.  
  746. In article <1992Jun6.180626.15917@welchgate.welch.jhu.edu> francois@welchgate.welch.jhu.edu (Francois Schiettecatte) writes:
  747.  
  748.    I have seen a very useful utility for think C 4.0.x called CMarker,
  749.    it puts an extra icon up on the menu bar of an editing window and
  750.    allows you to scroll down to functions very quickly. I have not
  751.    gotten it to work for think C 5.0.x.  Does anyone know how I could
  752.    get it to work with 5.0.x or is there a newer version which does.
  753.  
  754. The newer version of CMarker is a commercial product called "CMaster".
  755. It has the popup marker menu, along with a *ton* of other neat
  756. features, including the ability to rebind keys, paren/bracket kissing,
  757. auto indentation, and more.
  758.  
  759. CMaster sells for $69 (I think) through direct mail order from Jersey
  760. Scientific, whose number I have misplaced (sorry!). Drop me an email
  761. if you need the phone number, I can probably dig it up.
  762.  
  763. (No relation to Jersey Scientific besides satisfied customer and beta
  764. tester.)
  765.  
  766.     -phil
  767. - ----
  768.    Phil Shapiro                                   Software Engineer
  769.    Language Products Group                     Symantec Corporation
  770.            Internet: phils@cs.brandeis.edu
  771. - --
  772.    Phil Shapiro                                   Software Engineer
  773.    Language Products Group                     Symantec Corporation
  774.            Internet: phils@cs.brandeis.edu
  775.  
  776. +++++++++++++++++++++++++++
  777.  
  778. From: johnsone@uxh.cso.uiuc.edu (Erik A. Johnson)
  779. Organization: University of Illinois at Urbana
  780. Date: Tue, 9 Jun 1992 05:58:14 GMT
  781.  
  782. francois@welchgate.welch.jhu.edu (Francois Schiettecatte) writes:
  783. >   I have seen a very useful utility for think C 4.0.x called CMarker,
  784. >   it puts an extra icon up on the menu bar of an editing window and
  785. >   allows you to scroll down to functions very quickly. I have not
  786. >   gotten it to work for think C 5.0.x.  Does anyone know how I could
  787. >   get it to work with 5.0.x or is there a newer version which does.
  788.  
  789. phils@chaos.cs.brandeis.edu (Phil Shapiro) responds:
  790. >The newer version of CMarker is a commercial product called "CMaster".
  791. >It has the popup marker menu, along with a *ton* of other neat
  792. >features, including the ability to rebind keys, paren/bracket kissing,
  793. >auto indentation, and more.
  794.  
  795. Here's a summary I posted some time ago (March?) of what CMaster does,
  796. how much it costs, etc.  I'll repost it since there may be some interest
  797. in it.
  798.  
  799. - -------------------------------------------------------------------------
  800.  
  801. First of all, CMaster installs (when you install the package) a couple
  802. of resources into THINK C and modifies two others in order to patch
  803. itself into THINK C when a project opens (including a new WDEF and a
  804. couple of code resources).  It patches a couple of system routines
  805. (e.g. GetNextEvent/WaitNextEvent) and a couple of THINK C routines --
  806. all of this so that CMaster sees Events before THINK C and can modify
  807. or handle them first.  The bulk of CMaster is stored in a file in the
  808. System Folder, along with a prefs file, and is loaded in as necessary.
  809.  
  810. Basically, CMaster is an extension to THINK C, adding a number of
  811. editing capabilities that are (in my opinion) quite useful to the
  812. programmer.
  813.  
  814. When you open up a file (source or headers), you get a window that is
  815. somewhat modified from the standard editor window.  There CMaster puts a
  816. row of clickable icons down the left side of the window (each performs a
  817. different function -- more on this later), the title bar is modified to have
  818. one or more popup menus, and one menu (called, not surprisingly, "CMaster")
  819. is added to the menuBar.
  820.  
  821. The icons along the left edge of the window perform a number of functions,
  822. including:
  823.  
  824.   - forward/reverse searches
  825.   - commenting/uncommenting the selected text (or, if a user-definable
  826.     modifier key is pressed, inserting/removing #ifdef/#endif around the
  827.     selected text)
  828.   - multiple clipboards, each of which can be a first-in-first-out stack
  829.     (and can be modifier-clicked to show what is in the clipboard)
  830.   - several markers (allows you to mark a location in your code by clicking
  831.     on the icon and return to it later by clicking in the lower half of the
  832.     icon later -- on a mouseDown for longer than some definable number of
  833.     ticks, this icon will show the context of the mark)
  834.   - produce function prototypes of all of the functions within the current
  835.     selection (or the whole file if no selection), pushing the prototypes
  836.     onto the clipboard for pasting wherever you want
  837.   - scroll the window until the cursor is at the {top,middle,bottom} of the
  838.     screen OR with a modifier key, go to {top,middle,bottom} of the file
  839.     (with command key) or the current function (with option key).
  840.  
  841. The menus that are available to be put on the window's title bar are:
  842.  
  843.   - C -- the same as the CMaster menu put in the main menubar
  844.   - Actions -- menu equivalents to the icons
  845.   - Markers -- a list of all of the C functions in the file, lines
  846.                beginning with "#pragma mark", and any THINK C 5.0 marks
  847.                (listed in the order in the file, or, with a modifier key,
  848.                in alphabetical order); selecting one of these items jumps
  849.                directly to that function, line or marker
  850.   - Files -- a list of all #included files (don't need a modifier key)
  851.  
  852. The CMaster menu has several items that put up dialog windows to modify
  853. CMasters actions, including which icons to show, which menus to use, etc.
  854. Furthermore, CMaster has user-definable key-equivalents to all of its
  855. functions and to some of those of THINK C and to some other functions
  856. (e.g. forward character delete, line join, etc.).
  857.  
  858. Some other functions that I've gotten very used to having (i.e. I would
  859. be frustrated if I had to go back to programming without them) are:
  860.  
  861.   - "Kissing" -- when you type a right {parenthesis,bracket,brace},
  862.     CMaster briefly highlights the matching left {parenthesis,bracket,brace}
  863.     or beeping if it cannot find the matching one (this is definable --
  864.     you can turn off any of ')', ']', or '}', and the beeping function).
  865.   - Window location memory using the same resource ('MPSR' # 1005) that
  866.     MPW uses (also includes the position of the scrolling of the file and
  867.     the current selection).  CMaster allows you to use, ignore, or
  868.     selectively use this info.
  869.   - CMaster includes a "SnapBack" function -- if you use the Marker menu
  870.     or THINK C's "Find..." to go to another part of your file (such that
  871.     the old selection point is off the screen), then the Enter key will
  872.     SnapBack to your old insertion point.
  873.   - "Animated Thumb" -- the thumb of the scroll-bar allows you to scan
  874.     through the file in real-time as you drag the thumb.
  875.   - THINK C's double-click selects an alphanumeric word.  CMaster modifies
  876.     this so that if it is a CONTROL-double-click, it uses more of a C
  877.     oriented definition of "word"; for example, a CONTROL-double-click on
  878.     either "foo" or "bar" of "foo[0]->bar" would select the whole string.
  879.   - a 'vers' editor (it assumes you use the convention of naming your
  880.     project's resource file as projectname.rsrc) to create and modify
  881.     both ID 0 and ID 1 'vers' version resources.
  882.  
  883.  
  884. Well, this is a summary of CMaster.  On a more subjective level, I have
  885. found it very useful, especially the prototype generator (with THINK C 5.0
  886. having the option of requiring prototypes, it is WONDERFUL to be able to
  887. quickly generate the prototypes of all the functions in a source file),
  888. and the {[(-kissing feature (highlighting the matching left one, beep if
  889. you forgot to put one in :-).  And the Markers menu is invaluable --
  890. especially in debugging code -- it has saved me much time being able to
  891. jump directly from one function to another without the necessity of
  892. searching for functions in long source files.
  893.  
  894. Oh, the last price I heard was $69.95 (but that was some time ago, so
  895. don't hold me to it).  Address, phone number, etc., for Jersey Scientific:
  896.  
  897.    Jersey Scientific, Inc.
  898.    545 Eighth Ave., 19th Floor
  899.    New York, NY 10018
  900.  
  901.    (212) 736-0406
  902.    FAX: (212) 947-4981
  903.    e-mail:   Applelink:  jersci
  904.           Internet:  jersci@applelink.apple.com
  905.         Compuserve:  70400,3361
  906.  
  907. If you send e-mail to them, include your USMail address in your e-mail so
  908. that they can send you whatever info you need.  (Apparently it costs them
  909. $$$ to send stuff from Applelink.)
  910.  
  911.  
  912. (Standard disclaimer:  I have no connection with Jersey Scientific other than
  913. being a satisfied CMaster customer.   And as for the AAE Dept of UIUC or the
  914. UIUC in general ... I'm just a grad student ... they hardly know I exist. :-)
  915.  
  916.  
  917. Erik A. Johnson        \    Internet: johnsone@uxh.cso.uiuc.edu     \       |
  918. - ------------------------\    AmericaOnline: ErikAJ                   \    --+--
  919. Graduate Student         \--------------------------------------------\     |
  920. Aero/Astro Engineering    \  "Jesus said to him, 'I am the way, and    \    |
  921. University of Illinois at  \  the truth, and the life; no one comes to  \   |
  922.    Urbana-Champaign (UIUC)  \  the Father except through me.'" (Jn14:6)  \
  923.  
  924. +++++++++++++++++++++++++++
  925.  
  926. From: mike@uunet!tellab5!odgate (Mike J. Kelly)
  927. Date: 8 Jun 92 23:52:13 GMT
  928. Organization: Odesta Corporation
  929.  
  930. phils@chaos.cs.brandeis.edu (Phil Shapiro) writes:
  931.  
  932. >In article <1992Jun6.180626.15917@welchgate.welch.jhu.edu> francois@welchgate.welch.jhu.edu (Francois Schiettecatte) writes:
  933.  
  934. >   I have seen a very useful utility for think C 4.0.x called CMarker,
  935. >   it puts an extra icon up on the menu bar of an editing window and
  936. >   allows you to scroll down to functions very quickly. I have not
  937. >   gotten it to work for think C 5.0.x.  Does anyone know how I could
  938. >   get it to work with 5.0.x or is there a newer version which does.
  939.  
  940. >The newer version of CMarker is a commercial product called "CMaster".
  941. >It has the popup marker menu, along with a *ton* of other neat
  942. >features, including the ability to rebind keys, paren/bracket kissing,
  943. >auto indentation, and more.
  944.  
  945. >CMaster sells for $69 (I think) through direct mail order from Jersey
  946. >Scientific, whose number I have misplaced (sorry!). Drop me an email
  947. >if you need the phone number, I can probably dig it up.
  948.  
  949. >(No relation to Jersey Scientific besides satisfied customer and beta
  950. >tester.)
  951.  
  952. I agree -- Cmaster is a great product, and worth supporting.  The price
  953. is $69.95.
  954.  
  955. The number is 212-736-0406 or FAX at 212-947-4981.
  956.  
  957. - -- 
  958. - --
  959. Mike Kelly               Odesta Corporation, Northbrook, Illinois, USA
  960. ...!clout!odgate!mike    - Until odesta.com is registered.
  961. odgate!mike@clout.uucp   - From the Internet.
  962.  
  963. ---------------------------
  964.  
  965. End of C.S.M.P. Digest
  966. **********************
  967.